package com.ly.web.controller.erp;


import com.ly.heart.service.IWarehouseMaxMinInventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ly.common.annotation.Log;
import com.ly.common.core.controller.BaseController;
import com.ly.common.core.domain.AjaxResult;
import com.ly.common.enums.BusinessType;
import com.ly.heart.domain.WarehouseMaxMinInventoryEntity;

import javax.annotation.Resource;

/**
 * 仓库最大最小安全库存Controller
 *
 * @author cxl
 * @date 2024-07-26
 */
@Api(value = "仓库最大最小安全库存", tags = "仓库最大最小安全库存")
@RestController
@RequestMapping("/heart/MaxMinInventory")
public class WarehouseMaxMinInventoryController extends BaseController {

    @Resource
    private IWarehouseMaxMinInventoryService warehouseMaxMinInventoryService;

    /**
     * 查询仓库最大最小安全库存列表
     */
    @PreAuthorize("@ss.hasPermi('heart:MaxMinInventory:list')")
    @GetMapping("/list")
    @ApiOperation("查询仓库最大最小安全库存列表")
    public AjaxResult list(WarehouseMaxMinInventoryEntity warehouseMaxMinInventoryEntity)
    {
        //startPage();
        AjaxResult ajaxResult = warehouseMaxMinInventoryService.selectWarehouseMaxMinInventoryEntityList ( warehouseMaxMinInventoryEntity );
        return ajaxResult;
    }

    /**
     * 获取仓库最大最小安全库存详细信息
     */
    @PreAuthorize("@ss.hasPermi('heart:MaxMinInventory:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取仓库最大最小安全库存详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(warehouseMaxMinInventoryService.selectWarehouseMaxMinInventoryEntityById(id));
    }

    /**
     * 新增仓库最大最小安全库存
     */
    @PreAuthorize("@ss.hasPermi('heart:MaxMinInventory:add')")
    @Log(title = "仓库最大最小安全库存", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增仓库最大最小安全库存")
    public AjaxResult add(@RequestBody WarehouseMaxMinInventoryEntity warehouseMaxMinInventoryEntity)
    {
        return toAjax(warehouseMaxMinInventoryService.insertWarehouseMaxMinInventoryEntity(warehouseMaxMinInventoryEntity));
    }

    /**
     * 修改仓库最大最小安全库存
     */
    @PreAuthorize("@ss.hasPermi('heart:MaxMinInventory:edit')")
    @Log(title = "仓库最大最小安全库存", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改仓库最大最小安全库存")
    public AjaxResult edit(@RequestBody WarehouseMaxMinInventoryEntity warehouseMaxMinInventoryEntity)
    {
        return toAjax(warehouseMaxMinInventoryService.updateWarehouseMaxMinInventoryEntity(warehouseMaxMinInventoryEntity));
    }

    /**
     * 删除仓库最大最小安全库存
     */
    @PreAuthorize("@ss.hasPermi('heart:MaxMinInventory:remove')")
    @Log(title = "仓库最大最小安全库存", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除仓库最大最小安全库存")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(warehouseMaxMinInventoryService.deleteWarehouseMaxMinInventoryEntityByIds(ids));
    }

}
